import requests

from API_TEST.utils.log_util import logger


class BaseApi():
    """api 请求封装"""
    BaseUrl = ""

    def send(self, method, url, **kwargs):
        """ 发送请求 """
        url = self.BaseUrl + url
        logger.info(f"接口请求操作，{method}:{url}")
        logger.info(f"接口请求操作，请求的kwargs为：{kwargs}")
        resp = requests.request(method=method, url=url, **kwargs)
        logger.info(f"接口请求操作，接口响应为：{resp.text}")
        logger.info("==================================================")
        return resp
